import tools as Tools
import data as Data

screen = Tools.screen
Actor = Tools.Actor
Animation = Tools.Animation

class User():
    def __init__(self):
        import tkinter
        import ttkbootstrap as ttk
        self.Root = tkinter.Tk()
        self.Root.geometry('500x520')
        self.Lable = ttk.Label(self.Root,text='(x,y)',font=('Arial', 30))
        self.Tip = ttk.Label(self.Root,text='可以先在窗口的边缘试着根据在坐标轴上的点的特征，找找两坐标轴的位置.')
    def Click(self,event):
        self.Lable.config(text='({},{})'.format(event.x,event.y))
    def TryThisButtonCommand(self):
        self.Root.bind("<Button-1>",self.Click)
        self.Lable.pack()
        self.Tip.pack()
        self.Root.mainloop()

class Main:
    def __init__(self):
        Tools.Debug(3,'Part10')
    def Enter(self):
        self.TryThisButton = Actor('try_this',[Tools.CentralX(),Data.HEIGHT+150])
        self.Pic4 = Actor('pic4',[Tools.CentralX(),Tools.CentralY()+60])
        Animation(self.Pic4,'accel_decel',2,None,x=Tools.CentralX()-100)
        Animation(self.TryThisButton,'accel_decel',1,None,pos=[Data.WIDTH-150,Tools.CentralY()+50])
    def Update(self):
        screen.fill((0,0,0))
        self.Pic4.draw()
        self.TryThisButton.draw()
        screen.draw.text("你应该已经掌握了平面直角坐标系及其上点的坐标.",(100,100),"osans4.ttf")
        screen.draw.text("让我们看看平面直角坐标系中一些特殊点坐标的特征.",(100,150),"osans4.ttf")
        screen.draw.text("这里有一个不打寻常的坐标轴，让我们来试一试.请试着在窗口中四处点点并寻找其原点.",(100,200),"osans4.ttf")
    def Touch(self,pos):
        if self.TryThisButton.collidepoint(pos):
            User().TryThisButtonCommand()